package com.lxh.lxhcrm.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * @author ：鞠玮
 * 开发团队 ：lxh
 * 开发时间 ：2020/3/30 14:35
 * 类的名称 ：ConInvoiceRecord
 * 类的描述 ：合同的开票记录
 */
@Entity
@Table(name = "con_invoice_record", schema = "lxh_crm")
public class ConInvoiceRecord {
    private int conInvoiceRecId;
    private String invCon;
    private Double invMoney;
    private Timestamp invBeginDate;
    private Integer isReturnMon;
    private String conInvoiceRemark;

    /** 回款计划对象  可以考虑放弃 */
    private Returnmon returnmon;
    /** 票据类型对象 */
    private InvType invType;
    /** 经手人 */
    private Emp handleEmp;
    /** 合同对象 */
    private Contract contract;

    @ManyToOne
    @JoinColumn(name = "contract_id")
    public Contract getContract() {
        return contract;
    }

    public void setContract(Contract contract) {
        this.contract = contract;
    }

    @ManyToOne
    @JoinColumn(name = "return_id")
    public Returnmon getReturnmon() {
        return returnmon;
    }

    public void setReturnmon(Returnmon returnmon) {
        this.returnmon = returnmon;
    }

    @ManyToOne
    @JoinColumn(name = "inv_type_id")
    public InvType getInvType() {
        return invType;
    }

    public void setInvType(InvType invType) {
        this.invType = invType;
    }

    @ManyToOne
    @JoinColumn(name = "emp_id")
    public Emp getHandleEmp() {
        return handleEmp;
    }

    public void setHandleEmp(Emp handleEmp) {
        this.handleEmp = handleEmp;
    }

    @Id
    @Column(name = "con_invoice_rec_id", nullable = false)
    public int getConInvoiceRecId() {
        return conInvoiceRecId;
    }

    public void setConInvoiceRecId(int conInvoiceRecId) {
        this.conInvoiceRecId = conInvoiceRecId;
    }

    @Basic
    @Column(name = "inv_con", nullable = true, length = 255)
    public String getInvCon() {
        return invCon;
    }

    public void setInvCon(String invCon) {
        this.invCon = invCon;
    }

    @Basic
    @Column(name = "inv_money", nullable = true, precision = 0)
    public Double getInvMoney() {
        return invMoney;
    }

    public void setInvMoney(Double invMoney) {
        this.invMoney = invMoney;
    }

    @Basic
    @Column(name = "inv_begin_date", nullable = true)
    public Timestamp getInvBeginDate() {
        return invBeginDate;
    }

    public void setInvBeginDate(Timestamp invBeginDate) {
        this.invBeginDate = invBeginDate;
    }

    @Basic
    @Column(name = "is_return_mon", nullable = true)
    public Integer getIsReturnMon() {
        return isReturnMon;
    }

    public void setIsReturnMon(Integer isReturnMon) {
        this.isReturnMon = isReturnMon;
    }

    @Basic
    @Column(name = "con_invoice_remark", nullable = true, length = 255)
    public String getConInvoiceRemark() {
        return conInvoiceRemark;
    }

    public void setConInvoiceRemark(String conInvoiceRemark) {
        this.conInvoiceRemark = conInvoiceRemark;
    }

    @Override
    public String toString() {
        return "ConInvoiceRecord{" +
                "conInvoiceRecId=" + conInvoiceRecId +
                ", invCon='" + invCon + '\'' +
                ", invMoney=" + invMoney +
                ", invBeginDate=" + invBeginDate +
                ", isReturnMon=" + isReturnMon +
                ", conInvoiceRemark='" + conInvoiceRemark + '\'' +
                ", returnmon=" + returnmon +
                ", invType=" + invType +
                ", handleEmp=" + handleEmp +
                ", contract=" + contract +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ConInvoiceRecord that = (ConInvoiceRecord) o;
        return conInvoiceRecId == that.conInvoiceRecId &&
                Objects.equals(invCon, that.invCon) &&
                Objects.equals(invMoney, that.invMoney) &&
                Objects.equals(invBeginDate, that.invBeginDate) &&
                Objects.equals(isReturnMon, that.isReturnMon) &&
                Objects.equals(conInvoiceRemark, that.conInvoiceRemark) &&
                Objects.equals(returnmon, that.returnmon) &&
                Objects.equals(invType, that.invType) &&
                Objects.equals(handleEmp, that.handleEmp) &&
                Objects.equals(contract, that.contract);
    }

    @Override
    public int hashCode() {
        return Objects.hash(conInvoiceRecId, invCon, invMoney, invBeginDate, isReturnMon, conInvoiceRemark, returnmon, invType, handleEmp, contract);
    }
}
